<template>
  <ul class="container">
    <li v-for="(item, i) in searchUser" :key="i" class="item">
      <div class="info-box">
        <!-- 图片 -->
        <img
          v-lazy="item.result_model.avatar_large"
          class="search-user-avatar"
        />
        <div class="info">
          <!-- 用户名 -->
          <div class="name">
            <span>{{ item.result_model.user_name }}</span>
            <span v-show="item.result_model.job_title">{{
              item.result_model.job_title
            }}</span>
          </div>
          <!-- 相关数量 -->
          <div class="count">
            <span>{{ item.result_model.post_article_count }} 文章</span>
            <span>{{ item.result_model.follower_count }} 关注者</span>
          </div>
        </div>
      </div>
      <!-- 关注按钮 -->
      <button class="search-user-btn">关注</button>
    </li>
  </ul>
</template>

<script>
export default {
  props: {
    searchUser: {
      type: Array,
      default: () => {
        return []
      }
    }
  },
  created() {},
  methods: {}
}
</script>

<style lang="less" scoped>
.container {
  list-style: none;
  display: flex;
  flex-direction: column;
  padding: 1.5rem;

  .item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    align-items: center;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(178, 186, 194, 0.15);

    .info-box {
      display: flex;
      .search-user-avatar {
        width: 45px;
        height: 45px;
        border-radius: 50%;
        margin-right: 1.5rem;
        cursor: pointer;
      }

      .name {
        margin-bottom: 0.5rem;

        span {
          font-size: 1.23rem;
          font-weight: 600;
          color: #2e3135;
          margin-right: 1rem;
        }

        span:nth-child(2) {
          font-weight: 400;
          max-width: 300px;
          overflow: hidden;
          text-overflow: ellipsis;
          color: #8a9aa9;
        }
      }

      .count > span {
        margin-right: 1rem;
        position: relative;
        font-size: 1.17rem;
        color: #2e3135;
        white-space: nowrap;
      }

      .count > span:not(:last-child)::after {
        content: ' ';
        width: 2px;
        height: 2px;
        position: absolute;
        background-color: #4e5969;
        border-radius: 50%;
        margin-left: 6px;
        top: 8px;
      }
    }

    .search-user-btn {
      font-size: 13px;
      border: 1px solid #6cbd45;
      color: #6cbd45;
      background-color: #fff;
      padding: 0;
      width: 6.17rem;
      height: 2.5rem;
      cursor: pointer;
      flex: 0 0 auto;
    }
  }
  .item:hover {
    background-color: rgba(242, 242, 242, 0.4);
  }
}
</style>
